<%--
  Created by IntelliJ IDEA.
  User: bwj
  Date: 2021/6/22
  Time: 11:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    <title>
        区间管理
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="css/main.css" media="all">
    <script type="text/javascript" src="lib/loading/okLoading.js"></script>
    <script type="text/javascript" src="js/admin_region_addtrain.js"></script>
    <link rel="stylesheet" href="css/bootstrap.css">
    <style type="text/css">
        * {
            padding: 0;
            margin: 0;
        }

        #selectBoard {
            width: 100%;
            height: 20px;
            border: 1px solid black;
            border-radius: 5px;
            position: relative;
            margin: 0;
        }

        #selectBoard ul {
            width: 100px;
            background: white;
            position: absolute;
            border: 1px solid red;
            border-radius: 5px;
            display: none;
        }
        #selectBoard ul li {
            list-style: none;
        }

        #selectBoard ul li:hover {
            background: dodgerblue;
        }


    </style>

</head>

<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>路线管理</cite></a>
              <a><cite>路线添加</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon"
                                                                        style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <form class="layui-form x-center" action="" style="width:800px">
        <div class="layui-form-pane" style="margin-top: 15px;">
            <div class="layui-form-item">
                <div class="layui-input-inline">
<%--                    <table>--%>
<%--                        <tr>--%>
<%--                            <td><input type="text" name="lieche" placeholder="列车查询" autocomplete="off"--%>
<%--                                       class="layui-input" style="height: 25px; width: 120px;"></td>--%>
<%--                            <td><input type="button" value="查询" style="height: 25px; width: 50px;"/></td>--%>
<%--                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
<%--                        </tr>--%>
<%--                    </table>--%>
                </div>
            </div>
        </div>
    </form>
    <xblock>
<%--        <button class="layui-btn" onclick="addUpload()"><i class="layui-icon">&#xe608;</i>添加站点</button>--%>
<%--        <span class="x-right" style="line-height:40px">共有数据：${trainsListSize} 条</span>--%>
    </xblock>

        <div class="layui-form-item">
            <label class="layui-form-label">
                列车名
            </label>
            <div class="layui-input-block">
                <input type="text" id="trainname" name="complaint_name" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                列车类型
            </label>
            <div class="layui-input-block">
                <select name="community_id" id="traintype">
                    <option value="0">请选择动车类型</option>
                    <c:forEach items="${tntypes}" var="t">
                    <option value="${t.typeId}">${t.typeName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                出发时间
            </label>
            <div class="layui-input-block">
                <select name="community_id" id="hour">
                    <c:forEach begin="0" end="23" var="i">
                        <option value="${i}">${i}</option>
                    </c:forEach>
                </select><font size="5">&nbsp;&nbsp;:&nbsp;&nbsp;</font >
            <select name="community_id" id="second">
              <c:forEach begin="0" end="59" var="i">
                <option value="${i}">${i}</option>
              </c:forEach>
            </select>
        </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                车厢个数
            </label>
            <div class="layui-input-block">
                <input type="text" id="carriagenum" name="complaint_name" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-form-item">

        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                车厢行数
            </label>
            <div class="layui-input-block">
                <input type="text" id="rownum" name="complaint_name" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                车厢列数
            </label>
            <div class="layui-input-block">
                <input type="text" id="colnum" name="complaint_name" class="layui-input" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                里程价格
            </label>
            <div class="layui-input-block">
                <input type="text" id="price" name="complaint_price" class="layui-input" value="">
            </div>
        </div>
<%--        <div class="layui-form-item">--%>
<%--            <label class="layui-form-label">--%>
<%--                车厢类型--%>
<%--            </label>--%>
<%--            <div class="layui-input-block">--%>
<%--                <select name="community_id" id="community_id">--%>
<%--                    <option value="0">---请选择小区---</option>--%>
<%--                    <option value="1">东湖小区</option>--%>
<%--                    <option value="2">金华万府</option>--%>
<%--                </select>--%>
<%--            </div>--%>
<%--        </div>--%>
        <div class="layui-form-item">
            <label class="layui-form-label">
                站点
            </label>
            <div class="layui-input-block">
                <div id="selectBoard">
                    <ul>
                        <c:forEach items="${sites}" var="t">
                            <li><input type="checkbox" name="" value="${t.startsite.siteName}-${t.endsite.siteName}"/>${t.startsite.siteName}-${t.endsite.siteName}</li>
                        </c:forEach>

                    </ul>
                    <input type="text" name="complaint_name" id="shuju" class="layui-input" value="">
                </div>
            </div>
        </div>
    <div align="center"><input type="button" onclick="addsite()"  value="       添加       "  />
    </div>

    <div id="page"></div>
</div>
<script src="lib/layui/layui.js" charset="utf-8"></script>
<script src="js/x-layui.js" charset="utf-8"></script>
<script>
    layui.use(['laydate', 'element', 'laypage', 'layer'], function () {
        $ = layui.jquery;//jquery
        laydate = layui.laydate;//日期插件
        lement = layui.element();//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层
        okLoading.close($);
        //以上模块根据需要引入


        var start = {
            min: laydate.now()
            , max: '2099-06-16 23:59:59'
            , istoday: false
            , choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            min: laydate.now()
            , max: '2099-06-16 23:59:59'
            , istoday: false
            , choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('LAY_demorange_s').onclick = function () {
            start.elem = this;
            laydate(start);
        }
        document.getElementById('LAY_demorange_e').onclick = function () {
            end.elem = this
            laydate(end);
        }
    });

    //批量删除提交
    function delAll() {
        layer.confirm('确认要删除吗？', function (index) {
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
        });
    }

    function question_show(argument) {
        layer.msg('可以跳到前台具体问题页面', {icon: 1, time: 1000});
    }

    /*添加*/
    function activity_add(title, url, w, h) {
        x_admin_show(title, url, w, h);
    }

    //编辑
    function activity_edit(title, url, id, w, h) {
        url = url + "?id=" + id;
        x_admin_show(title, url, w, h);
    }

    /*删除*/
    function activity_del(obj, id) {
        layer.confirm('确认要删除吗？', {icon: 3, title: '提示信息'}, function (index) {
            $.ajax({
                type: "post",
                url: "xxx",
                data: {id: id},
                dataType: "json",
                success: function (data) {
                    //console.log(data);
                    if (data.status == 1) {
                        //发异步删除数据
                        $(obj).parents("tr").remove();
                        layer.msg(data.info, {icon: 6, time: 1000});
                        setTimeout(function () {
                            window.location.reload();
                        }, 1000);
                        return false;
                    } else {
                        layer.msg(data.info, {icon: 5, time: 1000});
                        return false;
                    }
                }
            });
            //发异步删除数据
            $(obj).parents("tr").remove();
            layer.msg('已删除!', {icon: 1, time: 1000});
        });
    }
</script>
<script src="js/js3/jquery-2.1.3.min.js"></script>

<script type="text/javascript">
    //定义一个空数组去接收value值

    var arr = [];

    //仿select的点击事件

    $("#selectBoard").click(function (event) {

        var ev = event || window.event;

        //阻止默认事件及封装

        if (ev.stopPropagation) {

            ev.stopPropagation();

        } else {

            ev.cancelable = true;

        }

        $("#selectBoard ul").css("display", "block");

    });


    $(window).click(function () {

        $("#selectBoard ul").css("display", "none");

    });

    //监听checkbox的value值 改变则执行下列操作

    $("input").change(function () {

        if ($(this).prop("checked")) {

            arr.push($(this).val() + "");

            console.log(arr);

        } else {
            arr.shift($(this).val() + "");

        }
        $("#shuju").val(arr)

    });
</script>
</body>
</html>